package keywords;

/**
 * @author shkstart
 * @date 2022/5/16 - 21:02
 */
public class StaticExer02 {
    public static void main(String[] args) {
        Account.setMinbalance(2000);
        Account.setRates(0.0034);
        Account a1 = new Account();
        a1.compareBalance();
//        System.out.println("账户id为:" + a1.getId1() + "存款余额为:" + a1.getDepositBalance());
        System.out.println(a1.toString());
        Account a2 = new Account();
        a2.compareBalance();
        System.out.println(a2.toString());
//        System.out.println("账户id为:" + a2.getId1() + "存款余额为:" + a2.getDepositBalance());
        Account a3 = new Account(2000.2,"231331");
        a3.setDepositBalance(2000.8);
        a3.compareBalance();
        System.out.println(a3.toString());
//        System.out.println("账户id为:" + a3.getId1() + "存款余额为:" + a3.getDepositBalance());




    }

}



class Account {
    private int id1;
//    private int password;
    private String password = "000000"; //初始密码
    private double depositBalance;
    private static double rates;
    private static double minbalance;
    private static int intl = 1001;

    public Account() {
        id1 = intl++;
    }

    public Account(double depositBalance,String password) {
        this();
        this.depositBalance = depositBalance;
        this.password = password;
    }

    public void compareBalance() {
        if (getDepositBalance() < this.minbalance) {
            System.out.println("很遗憾,你的存款余额小于存入的最小余额");
        }else {
            System.out.println("恭喜你，存入成功");
        }
    }

    public int getId1() {
        return id1;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public String getPassword() {
        return password;
    }

    public double getDepositBalance() {
        return depositBalance;
    }

    public void setDepositBalance(double depositBalance) {
        this.depositBalance += depositBalance;
    }

    public static void setRates(double rates) {
        Account.rates = rates;
    }

    public static double getRates() {
        return rates;
    }

    public static double getMinbalance() {
        return minbalance;
    }


    public static void setMinbalance(double minbalance) {
        Account.minbalance = minbalance;
    }

    @Override
    public String toString() {
        return "Account{" +
                "id1=" + id1 +
                ", password='" + password + '\'' +
                ", depositBalance=" + depositBalance +
                '}';
    }
}